package com.example.demo;

/**
 * @author zhuyc
 * @version 1.0
 * @description TODO
 * @date 2023/9/22 19:12
 */
public class VolatileDemo {

	public static  boolean flag=false;

	  public static void main(String[] args) throws InterruptedException {
	  	Thread t1=new Thread(()->{
			  int i=0;
			  while (!flag){
				  i++;
			  }
		});
		  t1.start();
		  System.out.println("begin start thread");
		  Thread.sleep(1000);
		  flag=true;

	  }
}
